package object.Integer;

public class IntegetTest {
    public static void main(String[] args) {
        String arr = "10,50,30,20,40";
        //1、根据逗号做分割
        String[] arr2 = arr.split(",");
        //准备一个整数数组，准备存储转换后的数字
        int[] nums = new int[arr2.length];
        //遍历字符串
        for (int i4 = 0; i4 < arr2.length; i4++) {
            //arr2[i]：每一个数字字符串
            // 将数字字符串转换为整数，并存入数组
            nums[i4] = Integer.parseInt(arr2[i4]);

        }

        //求最大值
        int max = nums[0];
        for (int i4 = 0; i4 < nums.length; i4++) {
            if (nums[i4]>max){
                max = nums[i4];
            }
        }
        System.out.println("最大值为"+max);
    }
}
